package com.rr.mymoney.bo.impl;

import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.rr.mymoney.bo.MonthBudgetBo;
import com.rr.mymoney.dao.MonthBudgetDao;
import com.rr.mymoney.model.MonthBudget;
import com.rr.mymoney.utils.BoImplUtils;

@Service
public class MonthBudgetBoImpl implements MonthBudgetBo {
    private MonthBudgetDao monthBudgetDao;

    @Autowired
    private MonthBudgetBoImpl(MonthBudgetDao monthBudgetDao) {
	this.monthBudgetDao = monthBudgetDao;
    }

    public void saveOrUpdate(MonthBudget monthBudget) {
	monthBudgetDao.saveOrUpdate(monthBudget);
    }

    public MonthBudget get(Long id) {
	return monthBudgetDao.get(id);
    }

    public void delete(MonthBudget monthBudget) {
	monthBudgetDao.delete(monthBudget);
    }

    public List<MonthBudget> getByUserId(Long userId) {
	return monthBudgetDao.getByUserIds(BoImplUtils.getAsList(userId));
    }

    public List<MonthBudget> getGenericBudget(Long userId) {
	return monthBudgetDao.getGenericBudget(BoImplUtils.getAsList(userId));
    }

    public List<MonthBudget> getGenericMonthlyBugdet(Long userId, int month) {
	return monthBudgetDao.getGenericMonthlyBugdet(BoImplUtils.getAsList(userId), month);
    }

    public List<MonthBudget> getSpecificMonthlyBugdet(Long userId, int month, int year) {
	return monthBudgetDao.getSpecificMonthlyBugdet(BoImplUtils.getAsList(userId), month, year);
    }
}
